/**
 * @file atcoder/dp/p/main.cpp
 * @brief
 * @see https://atcoder.jp/contests/dp/submissions/32651189
 * @author Ruiming Guo (guoruiming@stu.scu.edu.cn)
 * @copyright 2022
 * @date 2022/6/22 10:31:56
 **/

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
const int N = 1e5 + 4, MOD = 1e9 + 7;
ll D[N][2];
vi G[N];
void dfs(int u, int fa) {
  D[u][0] = 1, D[u][1] = 1;
  for (int v : G[u]) {
    if (v != fa) {
      dfs(v, u);
      D[u][0] *= (D[v][0] + D[v][1]) % MOD;
      D[u][0] %= MOD;
      D[u][1] *= D[v][0];
      D[u][1] %= MOD;
    }
  }
}

int main() {
  // High rating and good luck!
  int n;
  cin >> n;
  for (int i = 0, u, v; i < n - 1; ++i) {
    cin >> u >> v;
    G[u].push_back(v), G[v].push_back(u);
  }
  dfs(1, -1);
  cout << (D[1][0] + D[1][1]) % MOD << endl;
  return 0;
}
